home *** CD-ROM | disk | FTP | other *** search
/ HAKERIS 11 / HAKERIS 11.ISO / soft / development / Macromedia RoboHelp X5 / RoboHelpOffice.exe / Data1.cab / _0CAB170434F64735AFB0E6668964CEFF < prev    next >
Encoding:
Text File  |  2003-06-16  |  6.0 KB  |  257 lines

  1. <html>
  2. <head>
  3. <title><!--% WH_PROJECT_TITLE %--></title>
  4. <!--% FH_PROJECT_METATAGS %-->
  5. </head>
  6. <body>
  7. <script language="JavaScript">
  8. <!--
  9.  
  10. var gArrayCsh = new Array();
  11.  
  12. var gstrWindowOption = "";
  13. var gstrURL = "";
  14. var gbWithNavPane = false;
  15.  
  16. function CshEntityItem(strAliasId, nTopicNum, strUrl) 
  17. {
  18.     this.strAliasId = strAliasId;
  19.     this.nTopicNum = nTopicNum;
  20.     this.strUrl = strUrl;
  21. }
  22.  
  23.  
  24. //Try to get to topic number from hash string
  25. function GetTopicNumberAuto(strMayBeNumber)
  26. {
  27.    var nNum = -1;
  28.    if (strMayBeNumber.length >= 1)
  29.    {
  30.         var strTmp = strMayBeNumber;
  31.         var iEnd = strTmp.length;
  32.         for (var i=0; i<iEnd; i++)
  33.         {
  34.               var ch = strTmp.charAt(i);
  35.               if (!((ch == "0") || (ch == "1") ||
  36.                     (ch == "2") || (ch == "3") ||
  37.                     (ch == "4") || (ch == "5") ||
  38.                     (ch == "6") || (ch == "7") ||
  39.                     (ch == "8") || (ch == "9")))
  40.                   return GetTopicNumberById(strTmp);
  41.         }
  42.         nNum = parseInt(strTmp);
  43.    }
  44.    return nNum;
  45. }
  46.  
  47. function GetTopicNumber(strHashString)
  48. {
  49.     var nTopicEndPos = strHashString.indexOf(',')
  50.     if (nTopicEndPos == -1) { // no window option.
  51.         return GetTopicNumberOnly(strHashString);
  52.     }
  53.     else {
  54.         var strWindowOption = strHashString.substring(nTopicEndPos + 1, strHashString.length);
  55.         var strWithNavPane = 'withnavpane=true';
  56.         if (strWindowOption.toLowerCase().indexOf(strWithNavPane) == 0)
  57.         {
  58.             if (strWindowOption.length > strWithNavPane.length)
  59.                 gstrWindowOption = strWindowOption.substring(strWithNavPane.length + 1);
  60.             else
  61.                 gstrWindowOption = "";
  62.             gbWithNavPane = true;
  63.         }
  64.         else
  65.             gstrWindowOption = strWindowOption;
  66.         return GetTopicNumberOnly(strHashString.substring(0, nTopicEndPos));        
  67.     }
  68. }
  69.  
  70. function GetTopicNumberOnly(strTopicString)
  71. {
  72.     var nEqualPos = strTopicString.indexOf('=');
  73.     if (nEqualPos == -1) {
  74.         return GetTopicNumberAuto(strTopicString);
  75.     }
  76.     else {
  77.         var strValue=strTopicString.substring(nEqualPos + 1, strTopicString.length);
  78.         if (strTopicString.toLowerCase().indexOf("topicnumber") == 0) {
  79.             return parseInt(strValue);
  80.         } else if (strTopicString.toLowerCase().indexOf("context") == 0) {
  81.             return GetTopicNumberById(strValue);
  82.         } else if (strTopicString.toLowerCase().indexOf("remoteurl") == 0) {
  83.             gstrURL = strValue;
  84.             return -1;
  85.         }
  86.  
  87.     }
  88. }
  89.  
  90. //Find HomePage of the WebHelp system
  91. // we try to get the topic from remote project if it exists.
  92. function RedirectToHomePage()
  93. {
  94.     if (parent && parent != this && parent.goNext)
  95.     {
  96.         var sHome = parent.goNext();
  97.         if (sHome != "")
  98.             RedirectTo(sHome);
  99.     }
  100. }
  101.  
  102. function getHomePage()
  103. {
  104.     if (parent && parent != this && parent.getRelHomePage)
  105.     {
  106.         return parent.getRelHomePage(document.location.href);
  107.     }
  108.     return "";
  109. }
  110.  
  111. function addRemoteProject(strPath)
  112. {
  113.     if (parent && parent != this && parent.addProject)
  114.     {
  115.         parent.addProject(strPath);
  116.     }
  117. }
  118.  
  119. //Redirect page to...
  120. function RedirectTo(strUrl)
  121. {
  122.    if (gstrWindowOption.length != 0) {
  123.         var wnd = window.open(strUrl, "HelpStub", gstrWindowOption);
  124.         // close current window and rename the stub window to current window.
  125.         if (wnd)
  126.             wnd.focus();
  127.         if (parent)
  128.             parent.close();
  129.    }
  130.    else {
  131.     parent.document.location.href = strUrl;
  132.     window.focus();
  133.   }
  134. }
  135.  
  136. //Prompt the user that we can not find...
  137. function FailToFind(strMsg)
  138. {
  139.     RedirectToHomePage();
  140. }
  141.  
  142. //Find topic by topic number (defined in h file)
  143. function FindTopicByTopicNum(nTopicNum)
  144. {
  145.     var i = 0;
  146.     var iEnd = gArrayCsh.length;
  147.     for (i=0; i<iEnd; i++)
  148.     {
  149.         if (gArrayCsh[i].nTopicNum == nTopicNum)
  150.         {
  151.             var strURL = gArrayCsh[i].strUrl;
  152.             if (gbWithNavPane)
  153.             {
  154.                 var strHomePage = getHomePage();
  155.                 if (strHomePage.length != 0)
  156.                     strURL = strHomePage + strURL;
  157.             }    
  158.             RedirectTo(strURL);
  159.             return true;
  160.         }
  161.     }
  162.     FailToFind("Fail to find topic assocaite with topic number: " + nTopicNum);
  163.     return false;
  164. }
  165.  
  166. var oldPrefix = "HelpIdFromHTMLHelp_"
  167. //Find topic by topic id (alias id defined in ali file)
  168. function GetTopicNumberById(strTopicId)
  169. {
  170.    if (strTopicId.indexOf(oldPrefix) == 0)
  171.    {
  172.         strTopicId = strTopicId.substring(oldPrefix.length);
  173.    }
  174.  
  175.    var i = 0;
  176.    var iEnd = gArrayCsh.length;
  177.    for (i=0; i<iEnd; i++)
  178.    {
  179.     if (gArrayCsh[i].strAliasId.toLowerCase() == strTopicId.toLowerCase())
  180.     {
  181.         return gArrayCsh[i].nTopicNum;
  182.      }
  183.    }
  184.    gstrURL = "";
  185.    return -1;
  186. }
  187.  
  188. //Set Context-sensitive help entity...
  189. function SetCsh(n, strAliasId, nTopicNum, strUrl)
  190. {
  191.    gArrayCsh[n] = new CshEntityItem(strAliasId,nTopicNum,strUrl);
  192. }
  193.  
  194.  
  195. function getHash()
  196. {
  197.     if (parent && parent != this)
  198.         return parent.location.hash;
  199.     else
  200.         return "";
  201. }
  202. //-->
  203. </script>
  204. <script language="javascript">
  205. <!--% "<!-";"-"    %-->
  206. <!--% OutputRoboHelpCshDataBlock.htm("  SetCsh(%d,\"%s\",%d,\"%s\");\r\n"); %-->
  207. <!--% OutputRemoteProjectBlock.htm("  addRemoteProject(\"%s\");\r\n"); %-->
  208. <!--% "//-";"->" %-->
  209. </script>
  210. <script language="javascript">
  211. <!--
  212. //Find CSH according to hash string after this page
  213. if (getHash().length > 0)
  214. {
  215.    // VH 05/16/00 now support 
  216.    // TopicID=
  217.    // TopicNumber=
  218.    // RemoteURL=   
  219.    // and WindowsOptions
  220.    // with the format #a=xxx,b=xxx,c=xxx...
  221.    var strHashString = getHash().toString();
  222.    // change ? to : for remote URL. because java applet have some problem to pass a URL with two : inside the URL so we changed it. 
  223.    // so here need to change it back.
  224.    strHashString = strHashString.substring(1,strHashString.length);
  225.    strHashString = strHashString.replace("%072%057%057", "://");
  226.    var nTopicNum = GetTopicNumber(strHashString);
  227.  
  228.    if (nTopicNum != -1)
  229.    {
  230.       FindTopicByTopicNum(nTopicNum);
  231.    }
  232.    else
  233.    {
  234.       if (gstrURL.length > 0) 
  235.     RedirectTo(gstrURL);
  236.       else
  237.           RedirectToHomePage();
  238.    }
  239. }
  240. else
  241. {
  242.    RedirectToHomePage();
  243. }
  244. //-->
  245. </script>
  246. <noscript>
  247.  <p> Your browser does not support JavaScript. WebHelp Context-Sensitive Help requires JavaScript support to run.</p>
  248. </noscript>
  249. </body>
  250. </html>
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.